﻿<cfsilent>
	<cfscript>
		
		propAdvice = getProperty("serviceFactory").getBean("taskPropertyAdvice");
		
		event.setArg("pageTitle", "教学任务安排 - 体育项目 - 教学任务安排");
		
		termId = event.getArg("TermID");
		academicYear = event.getArg("AcademicYear");
		academicTerm = event.getArg("AcademicTerm");
		
		courseId = event.getArg("CID");
		teacherId = event.getArg("TCHID");
		teacherName = event.getArg('TNAME','未指定');
		
		taskId = event.getArg("TaskID");
		
		sql = "	SELECT
					c.course_name,
					i.institute_name,
					c.period,
					c.period_theory,
					c.period_practice,
					c.course_credit,
					c.cid,
					c.period_week
				FROM
					t_course c
					INNER JOIN t_institute i ON i.institute_id = c.institute_id
				WHERE
					c.cid = :courseId ";
		
		queryObj = new Query(datasource = application.dnsSlave);
		queryObj.addParam(name = "courseId", value = courseId, cfsqltype = "cf_sql_varchar");
		rs_courseEntity = queryObj.execute(sql = sql).getResult();
		
		sql = "	SELECT
					st.tsk_id,st.cidx,
					t.tch_name,
					st.task_week,
					st.task_period,
					st.task_limite,
					c.campus_name,
					ct.cr_type_name,
					st.task_prop
				FROM
					t_sport_task st
					INNER JOIN t_teacher t ON t.tch_id = st.tch_id
					INNER JOIN t_campus c ON c.campus_id = st.campus_id
					INNER JOIN t_classroom_type ct ON ct.cr_type = st.cr_type
				WHERE
					st.term_id = :termId 
					AND
					st.cid = :courseId 
				ORDER BY
					t.tch_name,st.cidx DESC";
		
		queryObj = new Query(datasource = application.dnsSlave);
		queryObj.addParam(name = "courseId", value = courseId, cfsqltype = "cf_sql_varchar");
		queryObj.addParam(name = "termId", value = termId, cfsqltype = "cf_sql_char");
		rs_task = queryObj.execute(sql = sql).getResult();
		
		sql = "	SELECT
					ct.cr_type,ct.cr_type_name
				FROM
					t_classroom_type ct 
				WHERE
					ct.cr_type IN ('001','005','008')
				ORDER BY
					ct.cr_type";
		
		queryObj = new Query(datasource = application.dnsSlave);
		rs_clsroomType = queryObj.execute(sql = sql).getResult();
		
		sql = "	SELECT
					c.campus_id,c.campus_name
				FROM
					t_campus c
				ORDER BY
					c.campus_id";
		
		queryObj = new Query(datasource = application.dnsSlave);
		rs_campus = queryObj.execute(sql = sql).getResult();
		
		currentTab = event.getArg("TabID", "labCreate");
		
		passArgs = structNew();
		structInsert( passArgs, "CID", courseId, true );
		
		if ( rs_task.recordCount ) {
			currentTab = event.getArg("TabID", "labTask");
		}

		rs_taskEntity = queryNew("tsk_id");

		if ( listLen(taskId, ",") eq 3 ) {
			currentTab = event.getArg("TabID", "labTaskDetail");

			sql = "	SELECT
						t.tsk_id,
						tt.tch_id,
						tt.tch_name,
						t.task_limite,
						t.task_chooesd,
						t.task_week,
						t.task_period,
						t.cr_type,
						t.campus_id,
						t.task_desc
					FROM
						t_sport_task t 
						INNER JOIN t_teacher tt ON tt.tch_id = t.tch_id
					WHERE
						t.tsk_id = :taskId ";
			
			queryObj = new Query(datasource = application.dnsSlave);
			queryObj.addParam(name = "taskId", value = taskId, cfsqltype = "cf_sql_varchar");
			rs_taskEntity = queryObj.execute(sql = sql).getResult();
		}

	</cfscript>
</cfsilent>

<div id="headArea">
	<div class="uiHeader uiHeaderWithImage ptm">
		<div class="clearfix uiHeaderTop">
			<div class="uiHeaderActions rfloat">
				<a class="uiButton" href="<cfoutput>#buildURL('sportTask')#</cfoutput>"><i class="mrs img btnList"></i><span class="uiButtonText">体育项目</span></a>
			</div>
			<div>
				<h2 class="uiHeaderTitle">
					<i class="uiHeaderImage img icon16x16 application"></i>体育项目 《<cfoutput>#rs_courseEntity.course_name#</cfoutput>》
				</h2>
			</div>
		</div>
	</div>
</div>

<div class="UIElement">
	<ul class="senateFirstPage">
		<li>
			<div class="clearfix" id="summary">
				<div class="UItab">
					<div class="tabLables">
						<cfif rs_task.recordCount>
							<span <cfif currentTab eq "labTask">class="active"</cfif> id="labTask" tabTarget="Task">教学任务</span>
						</cfif>
						<cfif rs_taskEntity.recordCount>
							<span <cfif currentTab eq "labTaskDetail">class="active"</cfif> id="labTaskDetail" tabTarget="TaskDetail">修改任务</span>
						</cfif>
						<cfif rs_taskEntity.recordCount eq 0>
							<span <cfif currentTab eq "labCreate">class="active"</cfif> id="labCreate" tabTarget="Create">新建任务</span>
						</cfif>
					</div>
				</div>
				<script language="javascript" type="text/javascript">
					//<![CDATA[
					<!--
					$(document).ready(function() {
						
						/* init Tab */
						$("div.tabContent").hide();
						$("div#" + $("div.tabLables span.active").attr("tabTarget")).show();
						
						$("div.tabLables > span").click(function(){
							var $targetID = $(this).attr("tabTarget");
							
							$("div.tabLables span").removeClass("active");
							$(this).addClass("active");
							
							$("div.tabContent").not('[id="' + $targetID + '"]').hide();
							$("div.tabContent#" + $targetID).show();
						});
						
					});
					// -->
					//]]>
				</script>
				
				<cfif rs_task.recordCount>

					<div id="Task" class="tabContent">
					
						<cfif rs_courseEntity.recordCount>
				
							<div class="noticeBlock">
								<h3>《<cfoutput>#rs_courseEntity.course_name#</cfoutput>》 任课单位: <cfoutput>#rs_courseEntity.institute_name#</cfoutput></h3>
								<p>
									<span class="img icon16x16 message"></span>
									总学时 <em><cfoutput>#rs_courseEntity.period#</cfoutput></em>, 其中理论学时<em><cfoutput>#rs_courseEntity.period_theory#</cfoutput></em>, 实践学时<em><cfoutput>#rs_courseEntity.period_practice#</cfoutput></em>. 课程总学分:<em><cfoutput>#numberFormat(rs_courseEntity.course_credit, '_.00')#</cfoutput></em>
								</p>
								<hr/>
							</div>
				
						</cfif>
						
						<table id="taskClassList" class="UIEditable">
							<thead>
								<tr>
									<td width="18"></td>
									<td width="40">课序号</td>
									<td >教师</td>
									<td width="50">周次</td>
									<td width="40">周学时</td>
									<td width="48">计划人数</td>
									<td width="50">校区</td>
									<td width="60">教室类别</td>
									<td width="18"></td>
									<td width="18"></td>
								</tr>
							</thead>
							<tbody>
                                <cfloop query="rs_task">
									<cfset structInsert(passArgs, "TaskID", rs_task.tsk_id, true) />
									<cfset propAdvice.parseProperty(rs_task.task_prop) />
									<tr class="editRows">
										<td><cfif not propAdvice.getLocked()><a href="<cfoutput>#buildURL('sportTaskRemoveDo', passArgs)#</cfoutput>" class="stat delete"></a></cfif></td>
										<td><span class="numeric"><cfoutput>#rs_task.cidx#</cfoutput></span></td>
										<td><cfoutput>#rs_task.tch_name#</cfoutput></td>
										<td><span class="numeric"><cfoutput>#rs_task.task_week#</cfoutput></span></td>
										<td><span class="numeric"><cfoutput>#rs_task.task_period#</cfoutput></span></td>
										<td><span class="numeric"><cfoutput>#rs_task.task_limite#</cfoutput></span></td>
										<td><cfoutput>#rs_task.campus_name#</cfoutput></td>
										<td><cfoutput>#rs_task.cr_type_name#</cfoutput></td>
										
										<cfif propAdvice.getLocked()>
											<td></td>
											<td><a href="<cfoutput>#buildURL('sportTaskUnlockDo', passArgs)#</cfoutput>" class="stat locked"></a></td>
										<cfelse>
											<cfif rs_taskEntity.recordCount and rs_taskEntity.tsk_id eq rs_task.tsk_id>
												<td></td>
												<td><span class="stat config"></span></td>
												<cfelse>
												<td><a href="<cfoutput>#buildURL('sportTaskByCourse', passArgs)#</cfoutput>" class="stat edit"></a></td>
												<td><a href="<cfoutput>#buildURL('sportTaskRelockDo', passArgs)#</cfoutput>" class="stat unlock"></a></td>
											</cfif>
										</cfif>
									</tr>
								</cfloop>
							</tbody>
						</table>	

					</div>
				
				</cfif>
				
				<cfif rs_taskEntity.recordCount>
					
					<div id="TaskDetail" class="tabContent">
						
						<cfif rs_courseEntity.recordCount>
				
							<div class="noticeBlock">
								<h3>《<cfoutput>#rs_courseEntity.course_name#</cfoutput>》 修改教学任务</h3>
								<p>
									<span class="img icon16x16 message"></span>
									请根据实际上课教师和全校体育项目上课学生任务规划上课班级容量
								</p>
								<hr/>
							</div>
				
						</cfif>
						
						<div id="updateBox">
							
							<form id="formUpdate" onSubmit="javascript:return processVerfiyForm('formUpdate');" class="formWrapper" method="post" action="<cfoutput>#buildURL('sportTaskUpdateDo')#</cfoutput>">
								
								<input name="TaskID" type="hidden" value="<cfoutput>#rs_taskEntity.tsk_id#</cfoutput>" />
								<input id="TeacherIDUpdate" name="TeacherID" type="hidden" value="<cfoutput>#rs_taskEntity.tch_id#</cfoutput>" />
								
								<div class="label">
									<span class="req">*</span><b>计划人数</b>
									<input name="PlanSize" type="text" class="typeSmallInt" verification="integer" maxlength="5" value="<cfoutput>#rs_taskEntity.task_limite#</cfoutput>" />
									<span>实际选课人数 <strong><cfoutput>#rs_taskEntity.task_chooesd#</cfoutput></strong></span>
								</div>
								
								<div class="label">
									<b>周次安排</b>
									<div class="secondRow">
									
										<cfset weekPlan = listToArray(rs_taskEntity.task_week, "-") />
									
										起始周 <input name="WeekStart" type="text" class="typeTinyInt" verification="integer" maxlength="2" value="<cfoutput>#weekPlan[1]#</cfoutput>" />
										结束周 <input name="WeekEnd" type="text" class="typeTinyInt" verification="integer" maxlength="2" value="<cfoutput>#weekPlan[2]#</cfoutput>" />
										
										周学时 <input name="TaskPeriod" type="text" class="typeSmallInt" verification="required" value="<cfoutput>#rs_taskEntity.task_period#</cfoutput>" />
									
									</div>
								</div>
								
								<div class="label">
									<b>主讲教师</b>
									<input name="TeacherName" id="TeacherNameUpdate" type="text" disabled="disabled" class="typeTextDynamic " verification="required" value="<cfoutput>#rs_taskEntity.tch_name#</cfoutput>(<cfoutput>#rs_taskEntity.tch_id#</cfoutput>)" /><span id="teacherUpdateTrigger" class="btnSearch"></span>
								</div>
							
								<hr/>
								
								<div class="label">
									<b>排课教室类别</b>
									<select name="ClassroomType">
                                        <cfloop query="rs_clsroomType">
											<option <cfif rs_taskEntity.cr_type eq rs_clsroomType.cr_type>selected="selected"</cfif> value="<cfoutput>#rs_clsroomType.cr_type#</cfoutput>"><cfoutput>#rs_clsroomType.cr_type_name#</cfoutput></option>
										</cfloop>
									</select>
								</div>
								
								<div class="label">
									<b>上课校区</b>
									<select name="CampusID" >
                                        <cfloop query="rs_campus">
											<option <cfif rs_taskEntity.campus_id eq rs_campus.campus_id>selected="selected"</cfif> value="<cfoutput>#rs_campus.campus_id#</cfoutput>"><cfoutput>#rs_campus.campus_name#</cfoutput></option>
										</cfloop>
									</select>
								</div>
							
								<div class="label">
									<b>排课要求</b>
									<textarea style="height:60px;" name="Describe"><cfoutput>#rs_taskEntity.task_desc#</cfoutput></textarea>
								</div>
							
								<hr/>
							
								<div class="lable">
									<input class="button" type="submit" value="更新教学任务" />
								</div>
								
							</form>
							
							<script language="javascript" type="text/javascript">
								//<![CDATA[
								<!--
							
								$(document).ready(function() {
								
									$("#teacherUpdateTrigger").click(function(){

										$("#updateBox").addClass("hidden_elem");
										$("#teacherBox").removeClass("hidden_elem");

									});
									
								});
								// -->
								//]]>
							</script>
							
						</div>
						
						<div id="teacherBox" class="hidden_elem">
						
							<form id="formSearch" class="formWrapper Transparent" method="post">
								<div class="label">
									<b>教师姓名或职工号</b>
									<input name="Keywords" id="Keywords" type="text" class="typeText" verification="required" maxlength="128" value="<cfoutput>#event.getArg('Keywords')#</cfoutput>" />
								</div>
								<hr/>
								<div class="lable">
									<input class="button1" type="submit" value="搜索教师" />
									<input id="formSearchReset" class="button" type="button" value="返回" />
								</div>
							</form>
						
							<div id="formSearchResult" class="UICardTable"></div>
						
							<script language="javascript" type="text/javascript">
								//<![CDATA[
								<!--
								$("input#formSearchReset").click(function(){
						
									$("#formBox").removeClass("hidden_elem");
									$("#teacherBox").addClass("hidden_elem");
								
								});
							
								$("#formSearch").submit(function(){
								
									if (processVerfiyForm('formSearch')) {
							
										$.getJSON(
												'<cfoutput>#buildURL("getTeacherByKeywords")#</cfoutput>',
												{
													'Keywords': $("form#formSearch input#Keywords").val(),
													'seed': (new Date()).getTime()
												},
												function(data) {
												
													$div = $("div#formSearchResult").html("").removeClass("hidden_elem");
													$("form#formAuth").addClass("hidden_elem");
												
													for (var i=0; i<data.length; i++) {
											
														var $element = $("<dl><dt><a><i class='sex" + data[i][2] + "'></i><dd><h3>" + data[i][1] + " [" + data[i][3] + "]" + "</h3><p>(" + data[i][0] + ")</p></dd></a></dt></dl>");
													
														$element
															.attr({
																'TeacherID' : data[i][0],
																'TeacherName' : data[i][1]
															})
															.click(function(){
															
																var name = $(this).attr('TeacherName');
																var id = $(this).attr('TeacherID');
															
																//$("form#formCreate input#TeacherID").val(id);
																//$("form#formCreate input#TeacherName").val(name + "(" + id + ")");
														
																$("form#formUpdate input#TeacherIDUpdate").val(id);
																$("form#formUpdate input#TeacherNameUpdate").val(name + "(" + id + ")");
															
																/* backForm */
																$("#updateBox").removeClass("hidden_elem");
																//$("#updateBox").removeClass("hidden_elem");
																$("#teacherBox").addClass("hidden_elem");
														
															})
															.appendTo($div);
													
													}
												
												});
								
									}
						
									return false;
								});
							
								// -->
								//]]>
							</script>
						
						</div>
						
					</div>
					
				</cfif>
				
				<cfif rs_taskEntity.recordCount eq 0>
				
					<div id="Create" class="tabContent">
					
						<cfif rs_courseEntity.recordCount>
				
							<div class="noticeBlock">
								<h3>《<cfoutput>#rs_courseEntity.course_name#</cfoutput>》 添加教学任务</h3>
								<p>
									<span class="img icon16x16 message"></span>
									请根据实际上课教师和全校体育项目上课学生任务规划上课班级容量
								</p>
								<hr/>
							</div>
				
						</cfif>
					
						<div id="formBox">
						
							<form id="formCreate" onSubmit="javascript:return processCreate();" class="formWrapper" method="post" action="<cfoutput>#buildURL('sportTaskCreateDo')#</cfoutput>">
							
								<input type="hidden" name="CourseID" value="<cfoutput>#rs_courseEntity.cid#</cfoutput>" />
								<input type="hidden" name="TermID" value="<cfoutput>#termId#</cfoutput>" />
								<input type="hidden" name="ClassroomType" value="008" />

								<input type="hidden" id="TeacherID" name="TeacherID" value="<cfoutput>#teacherId#</cfoutput>" />
							
								<div class="label">
									<span class="req">*</span><b>计划人数</b>
									<input name="PlanSize" type="text" class="typeSmallInt" verification="integer" maxlength="5" value="" />
									x
									<input name="TaskCount" id="TaskCount" type="text" class="typeCharInt" verification="integer" maxlength="1" value="3" />
									个教学班
									<p class="notice">体育项目通常会有一门课程重复开设的情况, 在这里您可以同时创建多个重复的教学任务.</p>
								</div>
							
								<hr/>
							
								<div class="label">
									<b>上课校区</b>
									<select name="CampusID">
                                        <cfloop query="rs_campus">
											<option value="<cfoutput>#rs_campus.campus_id#</cfoutput>"><cfoutput>#rs_campus.campus_name#</cfoutput></option>
										</cfloop>
									</select>
								</div>
							
								<div class="label">
									<b>排课设置</b> 
									<!--- 根据课程周学时 设置排课要求 --->
									<cfswitch expression="#rs_courseEntity.period_week#">
										<cfcase value="0">
											<p>不排课</p>
											<input name="TaskPeriod" type="hidden" value="0" />
											<input name="WeekStart" type="hidden" value="1" />
											<input name="WeekEnd" type="hidden" value="16" />
										</cfcase>
										<cfcase value="2">
											<p>每周一次课, 安排2小节</p>
											<input name="TaskPeriod" type="hidden" value="2" />
										</cfcase>
										<cfcase value="3">
											<p>每周一次课, 安排3小节</p>
											<input name="TaskPeriod" type="hidden" value="3" />
										</cfcase>
										<cfcase value="4">
											<p>
												<input name="TaskPeriod" type="radio" class="typeRadio" checked="checked" value="2+2" />
												每周两次课, 每次2小节
												<input name="TaskPeriod" type="radio" class="typeRadio" value="4" />
												每周一次课, 连续4小节
											</p>
										</cfcase>
										<cfcase value="5">
											<p>每周两次课, 一次2小节,一次3小节</p>
											<input name="TaskPeriod" type="hidden" value="3+2" />
										</cfcase>
										<cfcase value="6">
											<p>
												<input name="TaskPeriod" type="radio" class="typeRadio" checked="checked" value="3+3" />
												每周两次课, 每次3小节
												<input name="TaskPeriod" type="radio" class="typeRadio" value="2+2+2" />
												每周三次课, 每次2小节
											</p>
										</cfcase>
										<cfcase value="8">
											<p>
												<input name="TaskPeriod" type="radio" class="typeRadio" checked="checked" value="3+3+2" />
												每周三次课, 两次3小节, 一次2小节
												<input name="TaskPeriod" type="radio" class="typeRadio" value="2+2+2+2" />
												每周四次课, 每次2小节
											</p>
										</cfcase>
										<cfcase value="10">
											<p>
												<input name="TaskPeriod" type="radio" class="typeRadio" checked="checked" value="3+3+2+2" />
												每周四次课, 两次3小节, 两次2小节
												<input name="TaskPeriod" type="radio" class="typeRadio" value="2+2+2+2+2" />
												每周五次课, 每次2小节
											</p>
										</cfcase>
									</cfswitch>
								
									<cfif rs_courseEntity.period_week gt 0>
									
										<cfset howmanyWeeks = round(0.4+rs_courseEntity.period_practice / rs_courseEntity.period_week) />
										<cfset weekArray = [] />
									
										<div class="secondRow">
											<div class="UIBottonRow">
												<i>课程周次单元</i>
												<cfswitch expression="#howmanyWeeks#">
													<cfcase value="4">
														<cfloop list="1,5,9,13" index="start">
															<cfset arrayAppend(weekArray, [start, (start+howmanyWeeks-1)]) />
															<a href="javascript:changeWeek(<cfoutput>#start#</cfoutput>,<cfoutput>#(start+howmanyWeeks-1)#</cfoutput>);"><cfoutput>#start#</cfoutput>-<cfoutput>#(start+howmanyWeeks-1)#</cfoutput></a> 
														</cfloop>
														<!--- 特殊情况 用于春节、国庆时长调整 --->
														<cfif academicTerm eq "1">
															<cfloop list="4,8,12" index="start">
																<a href="javascript:changeWeek(<cfoutput>#start#</cfoutput>,<cfoutput>#(start+howmanyWeeks-1)#</cfoutput>);"><cfoutput>#start#</cfoutput>-<cfoutput>#(start+howmanyWeeks-1)#</cfoutput></a>
															</cfloop>
														</cfif>
													</cfcase>
													<cfcase value="8">
														<cfloop list="1,5,9" index="start">
															<cfset arrayAppend(weekArray, [start, (start+howmanyWeeks-1)]) />
															<a href="javascript:changeWeek(<cfoutput>#start#</cfoutput>,<cfoutput>#(start+howmanyWeeks-1)#</cfoutput>);"><cfoutput>#start#</cfoutput>-<cfoutput>#(start+howmanyWeeks-1)#</cfoutput></a>
														</cfloop>
														<!--- 特殊情况 用于春节、国庆时长调整 --->
														<cfif academicTerm eq "1">
															<cfloop list="4,8" index="start">
																<a href="javascript:changeWeek(<cfoutput>#start#</cfoutput>,<cfoutput>#(start+howmanyWeeks-1)#</cfoutput>);"><cfoutput>#start#</cfoutput>-<cfoutput>#(start+howmanyWeeks-1)#</cfoutput></a>
															</cfloop>
														</cfif>
													</cfcase>
													<cfcase value="10,11,12,14">
														<cfloop list="1,5" index="start">
															<cfset arrayAppend(weekArray, [start, (start+howmanyWeeks-1)]) />
															<a href="javascript:changeWeek(<cfoutput>#start#</cfoutput>,<cfoutput>#(start+howmanyWeeks-1)#</cfoutput>);"><cfoutput>#start#</cfoutput>-<cfoutput>#(start+howmanyWeeks-1)#</cfoutput></a>
														</cfloop>
														<!--- 特殊情况 用于春节、国庆时长调整 --->
														<cfif academicTerm eq "1">
															<cfloop list="4" index="start">
																<a href="javascript:changeWeek(<cfoutput>#start#</cfoutput>,<cfoutput>#(start+howmanyWeeks-1)#</cfoutput>);"><cfoutput>#start#</cfoutput>-<cfoutput>#(start+howmanyWeeks-1)#</cfoutput></a>
															</cfloop>
														</cfif>
													</cfcase>
													<cfcase value="16">
														<cfset arrayAppend(weekArray, [1, 16]) />
														<a href="javascript:changeWeek(1,16);">1-16</a> <a href="javascript:changeWeek(5,19);">5-19</a>
														<!--- 特殊情况 用于春节、国庆时长调整 --->
														<cfif academicTerm eq "1">
															<a href="javascript:changeWeek(4,19);">4-19</a>
														</cfif>
													</cfcase>
													<cfdefaultcase>
														<cfset arrayAppend(weekArray, [1, howmanyWeeks]) />
													</cfdefaultcase>
												</cfswitch>
												<a href="javascript:changeWeekSet(1);">顺延1周</a> <a href="javascript:changeWeekSet(-1);">提前1周</a>
											</div>
										</div>
										<div class="secondRow">
											<cfif arrayLen(weekArray) gt 1>
													<cfset randWeek = weekArray[randRange(1, arrayLen(weekArray))] />
												<cfelse>
													<cfset randWeek = weekArray[1] />
											</cfif>
											起始周
											<input name="WeekStart" id="WeekStart" type="text" class="typeTinyInt" verification="integer" maxlength="2" value="<cfoutput>#randWeek[1]#</cfoutput>" />
											结束周
											<input name="WeekEnd" id="WeekEnd" type="text" class="typeTinyInt" verification="integer" maxlength="2" value="<cfoutput>#randWeek[2]#</cfoutput>" />
										</div>
										<script language="javascript" type="text/javascript">
											//<![CDATA[
											<!--
											function changeWeekSet(offset) {
												
												var start = parseInt($("#WeekStart").val()) + offset;
												var end = parseInt($("#WeekEnd").val()) + offset;
											
												if (start > 0 && start < 16) { $("#WeekStart").val(start); }
												if (end < 19 && end > 0) { $("#WeekEnd").val(end); }
												if (end < start) { $("#WeekEnd").val(start); }											
											
												return void(0);
											}
											
											function changeWeek(start, end) {
												
												$("#WeekStart").val(start);
												$("#WeekEnd").val(end);
											
												return void(0);
											}
											// -->
											//]]>
										</script>
									</cfif>
								</div>
							
								<div class="label">
									<b>主讲教师</b>
									<input name="TeacherName" id="TeacherName" type="text" disabled="disabled" class="typeTextDynamic " verification="required" value="<cfoutput>#teacherName#</cfoutput>" /><span id="teacherTrigger" class="btnSearch"></span>
								</div>
								
								<div class="label">
									<b>排课要求</b>
									<textarea name="Describe" id="Describe"><cfoutput>#event.getArg('Describe')#</cfoutput></textarea>
								</div>
							
								<hr/>
								
								<div class="lable">
									<input class="button" type="submit" value="建立教学班" />
								</div>
							
							</form>
						
						</div>
					
					
						<script language="javascript" type="text/javascript">
							//<![CDATA[
							<!--
							function processCreate() {
									
								var teacherID = $("#TeacherID").val();
								var taskCount = parseInt($("#TaskCount").val());
								
								if (teacherID != "") {
									return processVerfiyForm('formCreate');
								}
								else {
									alert("请先指定任课教师");
									
									$("#formBox").addClass("hidden_elem");
									$("#teacherBox").removeClass("hidden_elem");
									
									return false;
								}
							}
							$(document).ready(function() {
								
								$("#teacherTrigger").click(function(){

									$("#formBox").addClass("hidden_elem");
									$("#teacherBox").removeClass("hidden_elem");

								});
									
							});
							// -->
							//]]>
						</script>
					
						<div id="teacherBox" class="hidden_elem">
						
							<form id="formSearch" class="formWrapper Transparent" method="post">
								<div class="label">
									<b>教师姓名或职工号</b>
									<input name="Keywords" id="Keywords" type="text" class="typeText" verification="required" maxlength="128" value="<cfoutput>#event.getArg('Keywords')#</cfoutput>" />
								</div>
								<hr/>
								<div class="lable">
									<input class="button1" type="submit" value="搜索教师" />
									<input id="formSearchReset" class="button" type="button" value="返回" />
								</div>
							</form>
						
							<div id="formSearchResult" class="UICardTable"></div>
						
							<script language="javascript" type="text/javascript">
								//<![CDATA[
								<!--
								$("input#formSearchReset").click(function(){
						
									$("#formBox").removeClass("hidden_elem");
									$("#teacherBox").addClass("hidden_elem");
								
								});
							
								$("#formSearch").submit(function(){
								
									if (processVerfiyForm('formSearch')) {
							
										$.getJSON(
												'<cfoutput>#buildURL("getTeacherByKeywords")#</cfoutput>',
												{
													'Keywords': $("form#formSearch input#Keywords").val(),
													'seed': (new Date()).getTime()
												},
												function(data) {
												
													$div = $("div#formSearchResult").html("").removeClass("hidden_elem");
													$("form#formAuth").addClass("hidden_elem");
												
													for (var i=0; i<data.length; i++) {
											
														var $element = $("<dl><dt><a><i class='sex" + data[i][2] + "'></i><dd><h3>" + data[i][1] + " [" + data[i][3] + "]" + "</h3><p>(" + data[i][0] + ")</p></dd></a></dt></dl>");
													
														$element
															.attr({
																'TeacherID' : data[i][0],
																'TeacherName' : data[i][1]
															})
															.click(function(){
															
																var name = $(this).attr('TeacherName');
																var id = $(this).attr('TeacherID');
															
																$("form#formCreate input#TeacherID").val(id);
																$("form#formCreate input#TeacherName").val(name + "(" + id + ")");
														
																//$("form#formUpdate input#TeacherIDUpdate").val(id);
																//$("form#formUpdate input#TeacherNameUpdate").val(name + "(" + id + ")");
															
																/* backForm */
																$("#formBox").removeClass("hidden_elem");
																//$("#updateBox").removeClass("hidden_elem");
																$("#teacherBox").addClass("hidden_elem");
														
															})
															.appendTo($div);
													
													}
												
												});
								
									}
						
									return false;
								});
							
								// -->
								//]]>
							</script>
						
						</div>
					
					</div>
					
				</cfif>

			</div>
		</li>
	</ul>
</div>